<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>教学工作量统计系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/Public/layui/css/layui.css"  media="all">
  <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
  <script src="/Public/layui/layui.js" charset="utf-8"></script>
  <script src="/Public/js/jquery-1.11.3.js" charset="utf-8"></script>
</head>

<body class="layui-layout-body">
  <div class="layui-layout layui-layout-admin">
    <div class="layui-header">
      <div class="layui-logo" style="font-weight: bold;"><a style="color: #777;" href="http://www.sinon.com/index.php/Admin/index/index">WORKLOAD</a></div>
      <!-- 头部区域（可配合layui已有的水平导航） -->
    
      <ul class="layui-nav layui-layout-right kit-nav">
        <li class="layui-nav-item">
          <a href="javascript:;">
            <img src="http://m.zhengjinfan.cn/images/0.jpg" class="layui-nav-img"> <?php echo ($login_info["teacher_name"]); ?>
          </a>
        </li>
        <li class="layui-nav-item" id="logout"><a href="javascript:;"><i class="fa fa-sign-out" aria-hidden="true"></i> 注销</a></li>
      </ul>
    </div>

    <div class="layui-side layui-bg-black">
      <div class="layui-side-scroll">
        <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
        <ul class="layui-nav layui-nav-tree"  lay-filter="test">
          <li class="layui-nav-item layui-nav-itemed" >
            <a class="" href="javascript:;">基础数据管理</a>
            <dl class="layui-nav-child">
              <dd><a href="http://www.sinon.com/index.php/Admin/Course/index">课程信息管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/Practice/index">课程设计信息管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/class/index">班级信息管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/major/index">专业信息管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/teacher/index">教师信息管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/college/index">院系设置</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/title/index">职称设置</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/term/index">学年度设置</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/system/index">系统设置</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/log/index">系统日志</a></dd>

            </dl>
          </li>
          <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">教学任务管理</a>
            <dl class="layui-nav-child">
              <dd><a href="http://www.sinon.com/index.php/Admin/CourseTask/index">课程教学任务管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/DesignTask/index">课程设计任务管理</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/ProjectTask/index">毕业设计任务管理</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">工作量统计</a>
            <dl class="layui-nav-child">
              <dd><a href="http://www.sinon.com/index.php/Admin/ProjectWorkload/index">毕业设计工作量统计</a></dd>
              <dd><a href="http://www.sinon.com/index.php/Admin/Workload/index">教学总工作量统计</a></dd>
            </dl>
          </li>
        </ul>
      </div>
    </div>

<style>
    .xinzeng {
        float: left;
        margin: 0 10px;
    }

    .topic {
        width: 100%;
        height: 40px;
        line-height: 40px;
        font-size: 20px;
        font-family: Arial;
        text-align: center;
        background: #e6e6e6;
        color: #666;
    }
    .layui-body{overflow-y: scroll;}
</style>
<div class="layui-body">
    <!-- 内容主体区域 -->
    <div class="topic">课程信息管理</div>
    <div style="height: 10px;"></div>
    <div id="courselistBody" style="padding: 10px;">
        <div><a href="http://www.sinon.com/index.php/Admin/course/add" class="layui-btn xinzeng">添加信息</a></div>
        <form class="layui-form">
            <div class="demoTable">
                快速查询：
                <div class="layui-inline">
                    <input class="layui-input" type="text" name="search" id="search" autocomplete="off"
                           placeholder="">
                </div>
                <div class="layui-btn" id="submit" lay-submit lay-filter="search">搜索</div>
            </div>
        </form>
        <table id="course" lay-filter="course"></table>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="edit">修改</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>
    </div>
</div>

<div class="layui-footer">
      <!-- 底部固定区域 -->
      © Design by tarkasi 2018
    </div>
  </div>
</body>
<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });
    layui.use('layer', function() { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
        $('#logout').on('click',function(){
            $('#logout:parent').removeClass('layui-show');
            $('#logout').removeClass('layui-this');
            layer.open({
                title:'温馨提示'
                ,skin: 'demo-class'
                ,content: '确认注销？'
                ,btn: ['确定', '取消']
                ,yes: function(index, layero){
                    //按钮【按钮一】的回调
                    $(location).attr('href', "<?php echo U('Login/logout');?>");
//                    $.post("<?php echo U('Login/logout');?>");
                    layer.close(index);
                }
                ,btn2: function(index, layero){
                    //按钮【按钮二】的回调

                    layer.close(index);
                    //return false 开启该代码可禁止点击该按钮关闭
                }
                ,cancel: function(){

                    //右上角关闭回调
                    //return false 开启该代码可禁止点击该按钮关闭
                }
            });
        });

    });

    $(document).ready(function(){
        $('input').attr('autocomplete', 'off'); 
    })

</script>


</html>



<script>
    
    layui.use(['table', 'jquery'], function () {
        var table = layui.table;
        var $ = layui.jquery;
        //监听工具条
        $('#submit').on('click', function () {
            var searchValue = $('#search').val();
            table.render({
                elem: '#course'
                , url: '<?php echo U("Course/index");?>' //数据接口
                , method: 'post'
                , where: {search: searchValue}
                , page: true //开启分页
                , limit: 10
                , cols: [[ //表头
//                    {type: 'checkbox', fixed: 'left'},
                    {field: 'course_id', title: '课程编号', width: "15%"},
                    {field: 'course_name', title: '课程名称', width: "15%"},
                    {field: 'credit', title: '学分', width: "10%"},
                    {field: 'hours', title: '总学时', width: "10%"},
                    {field: 'college_name', title: '开课单位', width: "20%"},
                    {field: 'note', title: '备注', width: "10%"},
                    {field: 'right', title: '操作', align: 'center', toolbar: '#barDemo', width: "20%"}
                ]]
            });
        });


        table.on('tool(course)', function (obj) {
            var data = obj.data;

            if (obj.event === 'del') {
                layer.confirm('删除此条记录？', function (index) {
                    $.ajax({
                        url: "<?php echo U('del');?>",
                        data: 'id=' + data.course_id,
                        method: 'post',
                        success: function (res) {
                            if (res) {
                                obj.del();
                                layer.close(index);
                                layer.msg('删除成功！！');
                            } else {
                                layer.close(index);
                                layer.msg('删除失败');
                            }
                        }
                    });
                });
            } else if (obj.event === 'edit') {
                $.ajax({
                    url: "<?php echo U('courseDetail');?>",
                    data: 'id=' + data.course_id,
                    method: 'post',
                    success: function (res) {
//                            console.log(res);
                        $('#courselistBody').html(res);
                    }
                });
            }
        });

        table.render({
            elem: '#course'
            , url: '<?php echo U("Course/index");?>' //数据接口
            , method: 'post'
            , page: true //开启分页
            , limit: 10
            , cols: [[ //表头
//                {type: 'checkbox', fixed: 'left'},
                {field: 'course_id', title: '课程编号', width: "15%"},
                {field: 'course_name', title: '课程名称', width: "15%"},
                {field: 'credit', title: '学分', width: "10%"},
                {field: 'hours', title: '总学时', width: "10%"},
                {field: 'college_name', title: '开课单位', width: "20%"},
                {field: 'note', title: '备注', width: "10%"},
                {field: 'right', title: '操作', align: 'center', toolbar: '#barDemo', width: "20%"}
            ]]
        });

    });

</script>

<style>
    .xinzeng {
        float: left;
        margin: 0 10px;
    }

    .topic {
        width: 100%;
        height: 40px;
        line-height: 40px;
        font-size: 20px;
        font-family: Arial;
        text-align: center;
        background: #e6e6e6;
        color: #666;
    }
    .layui-body{overflow-y: scroll;}
</style>